<?php if(!class_exists('raintpl')){exit;}?><?php $tpl = new RainTPL;$tpl_dir_temp = self::$tpl_dir;$tpl->assign( $this->var );$tpl->draw( dirname("header") . ( substr("header",-1,1) != "/" ? "/" : "" ) . basename("header") );?>
<?php $tpl = new RainTPL;$tpl_dir_temp = self::$tpl_dir;$tpl->assign( $this->var );$tpl->draw( dirname("navigator") . ( substr("navigator",-1,1) != "/" ? "/" : "" ) . basename("navigator") );?>

<ul class = "table-menu">
	<?php $counter1=-1; if( isset($table_menu) && is_array($table_menu) && sizeof($table_menu) ) foreach( $table_menu as $key1 => $value1 ){ $counter1++; ?>
		<?php if( $value1["multi"] == true ){ ?>

			<li><a href = "<?php echo $url;?>admin/<?php echo $dsfm_module;?>/<?php echo $value1["link"];?>"><img src="http://localhost/waterfantasy/admin/html/images/<?php echo $value1["icon"];?>"><?php echo $key1;?></a></li>

		<?php }else{ ?>
			<li><a href = "<?php echo $url;?>admin/<?php echo $dsfm_module;?>/<?php echo $value1["link"];?>"><img src="http://localhost/waterfantasy/admin/html/images/<?php echo $value1["icon"];?>"><?php echo $key1;?></a></li>
		<?php } ?>
	<?php } ?>

	<?php if( $dsfm_open_search==true ){ ?>
		<li class = "fr"><?php $tpl = new RainTPL;$tpl_dir_temp = self::$tpl_dir;$tpl->assign( $this->var );$tpl->draw( dirname("search") . ( substr("search",-1,1) != "/" ? "/" : "" ) . basename("search") );?></li>
	<?php } ?>

	<?php if( $dsfm_open_filter==true ){ ?>
		<li class = "fr"><?php $tpl = new RainTPL;$tpl_dir_temp = self::$tpl_dir;$tpl->assign( $this->var );$tpl->draw( dirname("filter") . ( substr("filter",-1,1) != "/" ? "/" : "" ) . basename("filter") );?></li>
	<?php } ?>

	<?php if( $dsfm_open_category==true ){ ?>
		<li class = "fr"><?php $tpl = new RainTPL;$tpl_dir_temp = self::$tpl_dir;$tpl->assign( $this->var );$tpl->draw( dirname("category") . ( substr("category",-1,1) != "/" ? "/" : "" ) . basename("category") );?></li>
	<?php } ?>
</ul>

<ol class = 'grid <?php if( $sortable==true ){ ?>sortable<?php } ?>'>
	<?php $counter1=-1; if( isset($row) && is_array($row) && sizeof($row) ) foreach( $row as $key1 => $value1 ){ $counter1++; ?>
	<li class = 'node <?php if( $sortable==true ){ ?>ui-state-default<?php } ?>' <?php if( $sortable==true ){ ?>order='<?php echo $value1["$sort_field"];?>'<?php } ?>>

		<?php $counter2=-1; if( isset($title) && is_array($title) && sizeof($title) ) foreach( $title as $key2 => $value2 ){ $counter2++; ?>
			<span class = "grid-image"><?php echo $value1[$value2["key"]];?></span>
		<?php } ?>

		<span class = 'tool alt0'>
		<?php $counter2=-1; if( isset($tool) && is_array($tool) && sizeof($tool) ) foreach( $tool as $key2 => $value2 ){ $counter2++; ?>
			<a href = "<?php echo $value2["$counter1"]["link"];?>" alt = "<?php echo $value2["$counter1"]["tool"];?>" title = "<?php echo $value2["$counter1"]["tool"];?>" <?php if( $value2["$counter1"]["tool"]==delete ){ ?>class = "delete"<?php } ?>><img src = '<?php echo $value2["$counter1"]["icon"];?>'></a>
		<?php } ?>
		</span>
	</li>
	<?php } ?>
</ol>

<?php if( $sortable==true ){ ?>
<input type = "button" value = "Update" class = "btn" id = "btn-sort">
<?php } ?>

<ul class = 'page'>
	<li class = 'text'>Page : </li>
	<?php $counter1=-1; if( isset($page) && is_array($page) && sizeof($page) ) foreach( $page as $key1 => $value1 ){ $counter1++; ?>
		<li class = 'number <?php echo $value1["active"];?>'>
			<a href = '?dsfm_page=<?php echo $value1["page"];?><?php echo $dsfm_filter_link;?><?php echo $dsfm_search_link;?>'><?php echo $value1["page"];?></a>
		</li>
	<?php } ?>
</ul>

<script language = "javascript">
	$(document).ready(function() {
		$(".img-popup").fancybox();

		$(".delete").click(function() {
			if(confirm('Please confirm DELETE this item.')){
				return true;
			}else{
				return false;
			}
		});
	});
</script>

<?php if( $sortable == true ){ ?>
<style>
	.sortable {width: <?php echo $sort_width;?>px;}
	.ui-state-default {border:none; color:#000; font-weight:normal;}
	.ui-state-default a {color:#000 !important;}
</style>
<script language = "javascript">
	$(document).ready(function() {

		$("#btn-sort").click(function(){
			var params = "p=";

			$(".sortable .node").each(function( i, val ) {
				params += $(val).attr("order")+",";
			});

			$.ajax({
				type: 'POST',
				url: "<?php echo $sort_file;?>",
				data: params,
				error:function(){
					alert("Error!");
				},
				success:function(data){
					alert(data);
				}
			});
		});

		$( ".sortable" ).sortable({
			placeholder: "ui-state-highlight"
		});
	});
</script>
<?php } ?>

<?php $tpl = new RainTPL;$tpl_dir_temp = self::$tpl_dir;$tpl->assign( $this->var );$tpl->draw( dirname("footer") . ( substr("footer",-1,1) != "/" ? "/" : "" ) . basename("footer") );?>